<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://www.bstek.com/dorado" prefix="d" %>
<jsp:directive.page import="com.bstek.dorado.data.db.*"/>
<jsp:directive.page import="com.bstek.dorado.utils.variant.VariantSet"/>
<jsp:directive.page import="java.util.*"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>    
    <title>时间轴</title>
 <style type="text/css">
div.time{
background-color:#F1B758;
}
div{
position:absolute;
}
</style>
	 

  </head>
  
  <body oncontextmenu='return false;'>
    <d:View config="com.xr.hr.personnel.ecfiDatePic">
   <a style="cursor:pointer;color=blue" onclick="location.reload();">刷新</a>
  
  <% 
    String hritemId=request.getParameter("HRITEMS_ID");
    String oosId=request.getParameter("ONOFF_STATION_ID");
    DBStatement dbs = new com.bstek.dorado.data.db.DBStatement();
    dbs.setSql("select min(start_date),max(end_date) from wf_ecfi where start_date<end_date and hritems_id="+hritemId+" and ONOFF_STATION_ID="+oosId);
	VariantSet vsse= dbs.query();
    long sd=vsse.getDate(0).getTime();
    long ed=vsse.getDate(1).getTime();
    long alld=ed-sd;
    long sdr=0,edr=0;
    dbs.setSql("select nvl(money,0)money,start_date,end_date,ecfi_id from wf_ecfi where start_date<end_date and hritems_id="+hritemId+" and ONOFF_STATION_ID="+oosId+" order by start_date");
    List list=dbs.queryForList();
    for(int i=0;i<list.size();i++){
      VariantSet vs=(VariantSet)list.get(i);
      sdr=vs.getDate("START_DATE").getTime();
      edr=vs.getDate("END_DATE").getTime();
      
      out.println("<div class='time' style='height:18;left:"+800*(sdr-sd)/alld+"px;top:"+(i*20+20)+"px;width:"+800*(edr-sdr)/alld+"' title='"+vs.getString("start_date").split(" ")[0]+"--"+vs.getString("end_date").split(" ")[0]+"'></div>");
      out.println("<div onclick='openEcfi("+vs.getValue("ECFI_ID")+");'  style='cursor:pointer;color=blue;height:18;left:"+800*(sdr-sd)/alld+"px;top:"+(i*20+20)+"px;width:200' >"+vs.getString("money")+"|"+vs.getString("start_date").split(" ")[0]+"--"+vs.getString("end_date").split(" ")[0]+"</div>");
      if(vs.getDate("START_DATE").getTime()==sd){
        
        out.println("");
      }
      if(vs.getDate("END_DATE").getTime()==ed){
      
      }
    }
  %>
 
  <% dbs.close();%>
  </d:View>
  </body>
</html>
